/***
 * 
 */
define( [ 'Vue', 'axios' ], function ( Vue, axios ) {
    return Vue.component('TableSql', {
        props: ['host', 'port', 'table'],

        data: function() {
            return {
                sqlList: []
            };
        },

        mounted : function () {
            var _this = this;

            axios.get( 'table-sql.json?table=' + this.table + '&host=' + this.host +'&port=' +this.port ) .then(function (response) {
                if ( 'string' == typeof response.data.Content ) {
                    return;
                }

                _this.sqlList = response.data.Content;
            });
        },

        template : `
            <div :title="JSON.stringify(sqlList)">
                <b v-if="sqlList.length > 0" style="color:red;">{{sqlList.length}}</b>
                <span v-else>{{sqlList.length}}</span>
            </div>
        `
    });
});